<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="OpenLS.UI.Themes.ZoomScrollBarResources"
                    xmlns:oui="clr-namespace:OpenLS.UI"
    >

  <Style TargetType="{x:Type RepeatButton}" x:Key="TransparentButton">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}" >
          <Grid Background="{TemplateBinding Background}">

            <Ellipse Name="ellipse" StrokeThickness="1" Stroke="#FF2F578D" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Ellipse.Fill>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                  <GradientStop Offset="0" Color="#FFECF0F6" />
                  <GradientStop Offset="0.10389610389610388" Color="#FFF2F6FC" />
                  <GradientStop Offset="0.25974025974025994" Color="#FFC7DBF3" />
                  <GradientStop Offset="0.44155844155844132" Color="#FFBCCDE2" />
                  <GradientStop Offset="0.55844155844155863" Color="#FF84A2C6" />
                  <GradientStop Offset="0.7532467532467535" Color="#FFCCDFF2" />
                  <GradientStop Offset="0.92207792207792194" Color="#FFF4F8FC" />
                  <GradientStop Offset="1" Color="#FFF1F5F8" />
                </LinearGradientBrush>
              </Ellipse.Fill>
            </Ellipse>
            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" 
                              Loaded="ContentPresenter_Loaded">
            </ContentPresenter>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property ="Fill" TargetName="ellipse">
                <Setter.Value>
                  <LinearGradientBrush EndPoint="0,1" StartPoint="0,0" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
                    <GradientStop Offset="0" Color="#FFF3F5F7" />
                    <GradientStop Offset="0.20779220779220775" Color="#FFFFFEFC" />
                    <GradientStop Offset="0.28571428571428581" Color="#FFFFFDF5" />
                    <GradientStop Offset="0.45454545454545425" Color="#FFF2D990" />
                    <GradientStop Offset="0.51948051948051932" Color="#FFF2D990" />
                    <GradientStop Offset="0.72727272727272707" Color="#FFFEDF83" />
                    <GradientStop Offset="0.90909090909090906" Color="#FFFFE59B" />
                    <GradientStop Offset="1" Color="#FFF2E9CB" />
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Width" Value="16"/>
    <Setter Property="Height" Value="16"/>
    <Setter Property="HorizontalAlignment" Value="Center"/>
    <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ZoomBackgroundKey}}"/>
  </Style>


  <Style x:Key="Scrollbar_LineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border 
            BorderBrush="Transparent" 
            BorderThickness="1" 
            CornerRadius="6" 
            Background="{DynamicResource ButtonGradient}">
            <ContentPresenter x:Name="ContentSite" />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground" Value="Gray" />
    <Setter Property="FontSize" Value="6pt" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="FontFamily" Value="Lucida Sans" />
    <Setter Property="VerticalAlignment" Value="Center" />
    <Setter Property="HorizontalAlignment" Value="Center" />
  </Style>

  <Style x:Key="ScrollBar_TrackRepeater"  TargetType="{x:Type RepeatButton}">
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Command" Value="ScrollBar.PageUpCommand" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Rectangle Fill="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ScrollBar_UpTrack" 
         BasedOn="{StaticResource ScrollBar_TrackRepeater}" 
         TargetType="{x:Type RepeatButton}">
    <Setter Property="Command" Value="ScrollBar.PageUpCommand" />
  </Style>
  <Style x:Key="ScrollBar_DownTrack" 
         BasedOn="{StaticResource ScrollBar_TrackRepeater}" 
         TargetType="{x:Type RepeatButton}">
    <Setter Property="Command" Value="ScrollBar.PageDownCommand" />
  </Style>


  <Style x:Key="ScrollBar_LeftTrack" 
         BasedOn="{StaticResource ScrollBar_TrackRepeater}" 
         TargetType="{x:Type RepeatButton}">
    <Setter Property="Command" Value="ScrollBar.PageLeftCommand" />
  </Style>

  <Style x:Key="ScrollBar_RightTrack" 
         BasedOn="{StaticResource ScrollBar_TrackRepeater}" 
         TargetType="{x:Type RepeatButton}">
    <Setter Property="Command" Value="ScrollBar.PageRightCommand" />
  </Style>

  <Style x:Key="ScrollBar_VerticalThumb" TargetType="{x:Type Thumb}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border CornerRadius="6" 
            BorderBrush="Transparent"     
            BorderThickness="0" 
            Background="{DynamicResource VerticalScrollGradient}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="MinHeight" Value="10" />
    <Setter Property="MinWidth" Value="10" />
  </Style>


  <Style x:Key="ScrollBar_HorizontalThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Height" Value="14"/>
    <Setter Property="Width" Value="14"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Path 
            Name="Ellipse" 
            Fill="{DynamicResource {x:Static oui:OfficeBrushes.ZoomNormalBackgroundKey}}"
            Stroke="{DynamicResource {x:Static oui:OfficeBrushes.ZoomNormalBorderBrushKey}}"
            StrokeThickness="1" 
            Data="M0 0 L8 0 L 8 8 L 4 12 L 0 8 L 0 0 M 4 4 L 4 8"/>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource {x:Static oui:OfficeBrushes.ZoomDarkBackgroundKey}}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource {x:Static oui:OfficeBrushes.ZoomDisabledBackgroundKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type ScrollBar}" x:Key="{x:Static oui:Styles.ZoomScrollBarStyleKey}">
    <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.ZoomBackgroundKey}}" />
    <Setter Property="Foreground" Value="{DynamicResource {x:Static oui:OfficeBrushes.ZoomTickBarForegroundKey}}" />
    <Setter Property="MinWidth" Value="120" />
    <Setter Property="Minimum"  Value="10" />
    <Setter Property="Maximum"  Value="400" />
    <Setter Property="Maximum"  Value="400" />
    <Setter Property="SmallChange"  Value="10" />
    <Setter Property="Orientation"  Value="Horizontal" />

    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollBar}">
          <Grid Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
              <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="*"/>
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Border Grid.Row="1" BorderThickness="0" 
                    Background="Transparent" CornerRadius="4"/>
            <RepeatButton Grid.Row="0" 
                          Style="{DynamicResource TransparentButton}" 
                          Command="ScrollBar.LineUpCommand" >
              <RepeatButton.Content><Path  Data="M 0 4 L 8 4 M 4 0 L 4 8" Stroke="#FF566576" StrokeThickness ="2"/>
              </RepeatButton.Content>
            </RepeatButton>

            <Track Grid.Row="1" Name="PART_Track"
                   IsDirectionReversed="True">
              <Track.DecreaseRepeatButton>
                <RepeatButton Style="{DynamicResource ScrollBar_UpTrack}"/>
              </Track.DecreaseRepeatButton>
              <Track.Thumb>
                <Thumb Style="{DynamicResource ScrollBar_HorizontalThumb}"/>
              </Track.Thumb>
              <Track.IncreaseRepeatButton>
                <RepeatButton Style="{DynamicResource ScrollBar_DownTrack}"/>
              </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton Grid.Row="2" 
                          Style="{DynamicResource TransparentButton}" 
                          Command="ScrollBar.LineDownCommand">
              <RepeatButton.Content>
                <Path Data="M 0 0 L 8,0" Stroke="#FF566576" StrokeThickness ="2"/>
              </RepeatButton.Content>
            </RepeatButton>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal" >
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="MinHeight" Value="10" />
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type ScrollBar}">
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Border Grid.Column="1" BorderThickness="0" 
                      Background="Transparent" CornerRadius="4"/>
                <RepeatButton Grid.Column="0" 
                                          Style="{DynamicResource TransparentButton}" 
                                          Command="ScrollBar.LineLeftCommand" >
                  <RepeatButton.Content>
                    <Path Data="M 0 0 L 8,0" Stroke="#FF566576" StrokeThickness ="2"/>
                  </RepeatButton.Content>
                </RepeatButton>
                <TickBar Grid.Column="1" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" Fill="{TemplateBinding Foreground}" Height="4" Placement="Bottom"/>
                <Track Grid.Column="1" Name="PART_Track">
                  <Track.DecreaseRepeatButton>
                    <RepeatButton Style="{DynamicResource ScrollBar_LeftTrack}"/>
                  </Track.DecreaseRepeatButton>
                  <Track.Thumb>
                    <Thumb Style="{DynamicResource ScrollBar_HorizontalThumb}"/>
                  </Track.Thumb>
                  <Track.IncreaseRepeatButton>
                    <RepeatButton Style="{DynamicResource ScrollBar_RightTrack}"/>
                  </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton Grid.Column="2" 
                              Style="{DynamicResource TransparentButton}" 
                              Command="ScrollBar.LineRightCommand">
                  <RepeatButton.Content>
                    <Path  Data="M 0 4 L 8 4 M 4 0 L 4 8" Stroke="#FF566576" StrokeThickness ="2"/>
                  </RepeatButton.Content>
                </RepeatButton>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>

</ResourceDictionary>